"""
Task 4

Write a function that takes on an input random ints (between 1 and 10) and 
returns the longest consecutive run and the length of that run of elements 
of the list.

Ex.  def task1(1,2,3,4,4,4,4,4,4,5,6,7,4,2,2,5) -> 6, 4
 def task1(1) -> 1, 1
 def task1() -> 0, None

Then create another function which takes on input result of function from the previous step and prints Informative
message about the longest consecutive run, something like - “Longest run is 6 of integers - 4”
"""

# Порада - використовуй дебаг
# Порада - цей кейс розбирався в суботу 13 серпня
from random import randint

randint(1, 10)


def return_largest_run(*args):
    result_dict = {}
    temp_dict = {}
    count = 0
    for i in range(len(args)):
        current_number = args[i]
        # add first value in demp dict
        if not temp_dict:
            count += 1
            temp_dict[current_number] = count
            continue
        # generate temp dict
        if list(temp_dict.keys())[0] == current_number:
            count += 1
            temp_dict[current_number] = count
            continue
        if list(temp_dict.keys())[0] != current_number:
            if args[i - 1] not in result_dict or result_dict.get(args[i - 1]) < temp_dict.get(args[i - 1]):
                result_dict[args[i - 1]] = temp_dict.get(args[i - 1])
                count = 1
                temp_dict = {}
                temp_dict[current_number] = count
                continue

    print(temp_dict),
    print(result_dict)


if __name__ == "__main__":
    return_largest_run(1, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 2)
